<!DOCTYPE html>
<html ng-app="planList" ng-cloak>
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link href="/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="/lib/fontAwesome/css/font-awesome.min.css" rel="stylesheet">
    <link href="/lib/navbar/css/responsive-menu.css" rel="stylesheet">
    <link href="/lib/bootstrap-datetime/css/jquery.datetimepicker.css" rel="stylesheet" media="screen">
    <link rel="stylesheet" type="text/css" href="/lib/angular-ui-grid/ui-grid.css"/>
    <link rel="stylesheet" type="text/css" href="/lib/angular-toastr/dist/angular-toastr.css"/>
    <link rel="stylesheet" href="/lib/angular-ui-select/dist/select.css">
    <link href="/css/style.css" rel="stylesheet">

    <script src="/lib/jquery/jquery.min.js"></script>
    <script src="/lib/bootstrap/js/bootstrap.min.js"></script>
    <script src="/lib/jquery/jquery.cookie.min.js"></script>

    <script src="/lib/navbar/js/modernizr.min.js" type="text/javascript"></script>
    <script src="/lib/navbar/js/modernizr-custom.js" type="text/javascript"></script>
    <script src="/lib/navbar/js/responsive-menu.js" type="text/javascript"></script>

    <script src="/lib/angular/angular.js"></script>
    <script src="/lib/angular-toastr/dist/angular-toastr.tpls.js"></script>
    <script src="/lib/angular-ui-select/dist/select.js"></script>
    <script src="/lib/angular-ui-grid/ui-grid.min.js"></script>
    <script src="/js/grid-pagination.js"></script>
    <script src="/js/directives.js"></script>
    <script src="/lib/bootstrap-datetime/js/jquery.datetimepicker.js"></script>
    <script src="/js/planListController.js"></script>

    <title>计划安排</title>
</head>
<body ng-controller="planListController">

<% include navbar %>

<div class="col-md-12 form-group" style="margin-top:10px">
    <div class="search-area big-panel-container">
        <input id="myRole" type="hidden" value="<%- user.role %>">

        <div class="col-md-12 big-panel">
            <div class="col-md-12 kick-padding-margin">
                <h2 class="group-head"><span>计划安排列表</span></h2>
            </div>

            <div class="expand-1">
                <div id="searchContent">
                    <div class="col-md-5 col-sm-5 kick-padding-margin">
                        <div class="form-group col-md-6 col-sm-6">
                            <label class="search-label">开始时间</label>
                            <div class="input-group">
                                <input id="start_date-from" class="form-control date" ng-model="filter.start_date.from"/>
                                <span class="input-group-addon glyphicon glyphicon-remove"
                                      style="position: relative;top:-0.5px"></span>
                            </div>
                        </div>
                        <div class="form-group col-md-6 col-sm-6">
                            <label>&nbsp;</label>
                            <div class="input-group ">
                                <input id="start_date-to" class="form-control date" ng-model="filter.start_date.to"/>
                                <span class="input-group-addon glyphicon glyphicon-remove"
                                      style="position: relative;top:-0.5px"></span>
                            </div>
                            <span style="position: relative;left:-18px;top:-28px">~</span>
                        </div>
                    </div>

                    <div class="col-md-5 col-sm-5 kick-padding-margin">
                        <div class="form-group col-md-6 col-sm-6">
                            <label class="search-label">结束时间</label>
                            <div class="input-group">
                                <input id="end_date-from" class="form-control date" ng-model="filter.end_date.from"/>
                                <span class="input-group-addon glyphicon glyphicon-remove"
                                      style="position: relative;top:-0.5px"></span>
                            </div>
                        </div>
                        <div class="form-group col-md-6 col-sm-6">
                            <label>&nbsp;</label>
                            <div class="input-group ">
                                <input id="end_date-to" class="form-control date" ng-model="filter.end_date.to"/>
                                <span class="input-group-addon glyphicon glyphicon-remove"
                                      style="position: relative;top:-0.5px"></span>
                            </div>
                            <span style="position: relative;left:-18px;top:-28px">~</span>
                        </div>
                    </div>

                    <div class="col-md-2 col-sm-2 kick-padding-margin" style="margin-top: 17px;padding-right: 15px;">
                        <button class="col-md-5 col-sm-5 pull-right btn btn-danger margin-top" ng-click="reset()"><i
                                    class="fa fa-clock-o"></i>&nbsp;&nbsp;重置
                        </button>
                        <button class="col-md-5 col-sm-5 pull-right btn btn-primary margin-top"
                                style="margin-right: 20px;" ng-click="search()">
                            <i class="fa fa-search"></i>&nbsp;&nbsp;搜索
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="result-area big-panel-container">
        <div class="col-md-12 big-panel kick-padding-margin" style="padding-bottom: 30px">
            <div class="col-md-12 kick-padding-margin  margin-top-20">

                <div class="col-md-12 ">
                    <% if(user.role === 'admin') { %>
                    <div class="btn-toolbar grid-toolbar" role="toolbar">
                        <div class="col-md-10">
                        </div>
                        <button type="button" class="pull-right col-md-1 btn btn-primary btn-sm grid-menu-btn"
                                style="margin-bottom: 10px" onclick="javascript:window.location.href='/plan/add'">
                            <i class="fa fa-plus"></i>&nbsp;&nbsp;发布计划&nbsp;&nbsp;</button>
                    </div>
                    <% } else if(user.role==='manager') { %>
                    <div class="btn-toolbar grid-toolbar" role="toolbar">
                        <div class="col-md-10">
                        </div>
                        <button type="button" class="pull-right col-md-1 btn btn-primary btn-sm grid-menu-btn"
                                style="margin-bottom: 10px" onclick="javascript:window.location.href='/plan/input'">
                            <i class="fa fa-edit"></i>&nbsp;&nbsp;填写计划&nbsp;&nbsp;</button>
                    </div>
                    <% } %>
                    <div ui-grid="gridOption" theme="bootstrap" ng-style="{height:(gridOption.data.length*30)+55+'px'}"
                         ui-grid-resize-columns ui-grid-pagination>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    $(function ($) {
        var menu = $('.rm-nav').rMenu({
            minWidth: '960px'
        });
    });
    $('[data-toggle="tooltip"]').tooltip();

    $(".glyphicon-remove").each(function(){
        $(this).click(function(){
            var ele = $(this).siblings("input")[0];
            $(ele).val("");
            $(ele).change();
        });
    });
</script>
</body>
</html>